import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

/// 发送通知工具
class KqNoticeUtil {
  static const _methodChannelName = 'flutter.keqiang.com/notice';

  static const _platformMethod = MethodChannel(_methodChannelName);

  /// 接口调试模式推送通知
  /// 功能简介：发送本地推送通知， 点击通知复制[copyContent]到剪切板，用于运维快速拿到请求接口
  /// [title] 标题
  /// [showContent] 显示内容
  /// [copyContent] 点击通知后复制的内容
  /// 注意：Android端需要实现[INotice]
  static Future<bool> showNoticeForApiTest(
      {required String title,
      required String showContent,
      required String copyContent}) async {
    try {
      return await _platformMethod.invokeMethod('showNoticeForApiTest', {
        'title': title,
        'showContent': showContent,
        'copyContent': copyContent,
      });
    } on PlatformException catch (e) {
      debugPrint(e.message);
      return false;
    }
  }
}
